package com.fenxiangtech.mall.web.controller.v1;

import com.fenxiangtech.mall.entity.User;
import com.fenxiangtech.mall.service.UserService;
import com.fenxiangtech.mall.dto.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller("userControllerV1")
@RequestMapping("/v1/user")
public class UserController {

    @Autowired
    private UserService userService;

    @PostMapping("/wx_info")
    @ResponseBody
    public Result<User> updateUser(@RequestBody User user) {
        boolean success = userService.updateUser(user);
        return new Result<>(success, user);
    }

}
